import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', {
    state: () => ({
        content: [
            '博客使用指南-概览',
            '博客使用指南-配置',
            '博客使用指南-编写文章',
            '博客使用指南-搜索',
            '博客使用指南-构建发布',
        ],
        DetailContent: [
            '博客使用指南-概览',
            '博客使用指南-配置',
            '博客使用指南-编写文章',
        ],
        date: [
            '2023-02-09',
            '2023-02-09',
            '2023-02-02',
            '2023-02-01',
            '2023-02-01',
        ],
        BottonTilet: [
            '概览',
            '配置',
            '编写文章',
            '搜索',
            '构建发布'
        ],
        englishArticles: "Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem.Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga.ki oditatquam, ad quibus unda vellamenimin cusam et tacea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat. Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.",
        Name: "Eason chan",
        // 文章总数居
        articleTheme: [
            {
                id: 0,
                Title: '蜀道难',
                Content: '噫，吁嚱，危乎高哉！ 蜀道之难，难于上青天！ 蚕丛及鱼凫，开国何茫然！ 尔来四万八千岁，不与秦塞通人烟。 西当太白有鸟道，可以横绝峨嵋巅。 地崩山摧壮士死，然后天梯石栈方钩连。 上有六龙回日之高标，下有冲波逆折之回川。 黄鹤之飞尚不得过，猿猱欲度愁攀援。 青泥何盘盘，百步九折萦岩峦。 扪参历井仰胁息，以手抚膺坐长叹。 问君西游何时还？ 畏途巉岩不可攀。 但见悲鸟号古木，雄飞从雌绕林间。 又闻子规啼夜月，愁空山。 蜀道之难，难于上青天，使人听此凋朱颜。 连峰去天不盈尺，枯松倒挂倚绝壁。 飞湍瀑流争喧豗，砯崖转石万壑雷。 其险也若此，嗟尔远道之人，胡为乎来哉。 剑阁峥嵘而崔嵬，一夫当关，万夫莫开。 所守或匪亲，化为狼与豺。 朝避猛虎，夕避长蛇，磨牙吮血，杀人如麻。'
            },
            {
                id: 1,
                Title: 'Life is too short',
                Content: "Life is too short to spend time with people who suck the happiness out of you. If someone wants you in their life, they'll make room for you. You shouldn't have to fight for a spot. Never, ever insist yourself to someone who continuously overlooks your worth. And remember, it's not the people that stand by your side when you're at your best, but the ones who stand beside you when you' re at your worst that are your true friends."
            },
            {
                id: 2,
                Title: 'Hope is the light',
                Content: "In the flood of darkness, hope is the light. It brings comfort, faith, and confidence. It gives us guidance when we are lost, and gives support when we are afraid. And the moment we give up hope, we give up our lives. The world we live in is disintegrating into a place of malice and hatred, where we need hope and find it harder. In this world of fear, hope to find better, but easier said than done, the more meaningful life of faith will make life meaningful."
            },
            {
                id: 3,
                Title: 'Live truly',
                Content: "Only when you understand the true meaning of life can you live truly. Bittersweet as life is, it's still wonderful, and it's fascinating even in tragedy. If you're just alive, try harder and try to live wonderfully."
            },
            {
                id: 4,
                Title: 'Sunshine',
                Content: "I believe there is a person who brings sunshine into your life. That person may have enough to spread around. But if you really have to wait for someone to bring you the sun and give you a good feeling, then you may have to wait a long time."
            },
        ],
        // 页面展示的数据
        ShowData: []
    }),
    getters: {
    },
    actions: {
        // 接受页面展示的数据
        renderedData(data) {
            this.ShowData = data
        },
        //添加数据
        AddData(val) {
            this.articleTheme.unshift(val)
        },
        //删除数据
        Delete(val) {
            for (let index = 0; index < this.articleTheme.length; index++) {
                if (this.articleTheme[index].id == val) {
                    this.articleTheme.splice(index, 1)
                }
            }
        },
        //姓名的修改
        modifyName(val){
            this.Name = val
        }
    },
    // 数据持久化
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'wenzhangData', //设置存储的key
                storage: localStorage, //表示存储在localStorage
            }
        ]
    }
})